import Image from '@/components/didaima/d-image/indexView.vue'
import type { LeftComponentState } from '@/types'

export const defaultStyle = {
  width: 220,
  height: 200,
  top: 0,
  left: 0
}

export const createImageComponent = (
  url: string,
  left = defaultStyle.left,
  top = defaultStyle.top
) =>
  ({
    // 名字
    name: '图片',
    // 内容
    value: url,
    // 类型
    type: 'image',
    // 组件
    component: Image,
    // 组件样式
    style: {
      ...defaultStyle,
      top,
      left
    }
  }) as LeftComponentState
